Question 1 ( 20 points ).
A number is "perfect" if it equals the sum of its divisors, including 1 but excluding itself. For example, 6 is perfect because 6 = 1 + 2 + 3. Similarly, 28 is perfect because 28 = 1 + 2 + 4 + 7 + 14. However, 4 is not perfect because 4 is not equal to 1 + 2.
Complete the implementation of the boolean method perfect below.
// return true
if p is a "perfect" number; false otherwise
static boolean perfect( int p )
{
int sum = 0;
for( int i = 1; i <
p; i++ )
if(
p%i == 0 ) sum+=i;
return ( sum > 0 ? sum == p : false);
}